package com.atguigu.controller;

import com.atguigu.pojo.Delivery;
import com.atguigu.service.DeliveryService;
import com.atguigu.service.impl.DeliveryServiceImpl;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

@WebServlet("/delivery/RealUpdate")
public class UserDeliveryRealUpdateController extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String id = req.getParameter("id");//快递的id
        String deliveryName = req.getParameter("user_name");
        Integer companyId = Integer.valueOf(req.getParameter("cat_id"));
        String phone = req.getParameter("phone");
        String address = req.getParameter("password");
        String date = req.getParameter("date");
        Integer status = Integer.valueOf(req.getParameter("a"));
        //可以根据这个快递的id修改这个快递的信息
        DeliveryService deliveryService = new DeliveryServiceImpl();
        deliveryService.updateDeliveryById(Integer.valueOf(id),deliveryName,companyId,phone,address,date,status);
        resp.sendRedirect("/delivery/List");
    }
}
